
package org.come.npc;

import java.math.BigDecimal;
import java.util.List;
import org.come.Frame.NPCJfram;
import org.come.Frame.ShoppingBuyJframe;
import org.come.action.NpcMenuAction;
import org.come.model.Shop;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.FormsManagement;
import org.come.until.UserMessUntil;

public class NpcShop implements NpcMenuAction {
	public NpcShop() {
	}

	@Override
    public void menuControl(String type) {
		String npctype;
		if (NPCJfram.getNpcJfram().getNpcjpanel().getMapMonsterBean() != null && NPCJfram.getNpcJfram().getNpcjpanel().getMapMonsterBean().getRobottype() == 2) {
			npctype = Agreement.getAgreement().clickMonstersAgreement("" + NPCJfram.getNpcJfram().getNpcjpanel().getMapMonsterBean().getI());
			SendMessageUntil.toServer(npctype);
		} else {
			npctype = NPCJfram.getNpcJfram().getNpcjpanel().getNpcInfoBean().getNpctable().getNpctype();
			if (!"1106".equals(npctype) && !"515".equals(npctype) && !"605".equals(npctype)) {
				List<Shop> npcshop = (List)UserMessUntil.getNpcshop().getNpcShopMap().get(npctype);
				ShoppingBuyJframe.getShoppingBuyJframe().getShoppingBuyJpanel().showshop(npcshop, npctype, (BigDecimal)null);
				FormsManagement.showForm(23);
			} else {
				String senmes = Agreement.getAgreement().BuyNPCGoodsAgreement(npctype);
				SendMessageUntil.toServer(senmes);
			}
		}
	}
}
